<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>最新招聘会</title>
	<link rel="stylesheet" href="./styles/css/common.css">
</head>

<body>

	<div class="zph_style">
		<!-- 公共顶部 -->
		<!-- <include src="./include/top.html"></include> -->
		<script src="http://rsj.beijing.gov.cn/header.js"></script>

		<!-- 公共头部 -->
		<include src="./include/header.art" data="{nav:'01'}"></include>
		<!-- nav图 -->
		<div class="resultpage_nav"></div>
		<!-- 查询和选项 -->
		<div class="resultpage_option clearfix">
			<!-- 查询样式 -->
			<div class="z_b_bottom clearfix">
				<div class="option_left left">
					招聘会列表
				</div>
				<div class="option_right left">
					<label style="top: 0px;left: 18px;" class="passes Showpass" for="rs">请输入您要查询的招聘会、单位或岗位</label>
					<input class="search_input" type="text" id="rs">
					<input type="button" class="search_submit J_search_submit" value="">
				</div>
				<div class="zphxx_con left">
					<p>近期召开<span class="zph_num1">0</span>场招聘会，共有<span class="zph_num2">0</span>个单位参会</p>
				</div>
			</div>
			<!-- 查询条件 -->
			<div class="z_cxtj">
				<div class="date_c clearfix">
					<span style="margin-left: 0;">开始时间</span>
					<div class="input_div">
						<input type="text" id="min" readonly="readonly" autocomplete="off">
					</div>
					<span>结束时间</span>
					<div class="input_div">
						<input type="text" id="max" readonly="readonly" autocomplete="off">
					</div>
				</div>
				<!-- 召开区 -->
				<div class="z_zkq clearfix">
					<!-- <span class="left z_zkq_title">召开区</span> -->
					<div class="z_zkq_list left">

					</div>
				</div>
			</div>
		</div>
		<!-- 招聘会列表 -->
		<div class="zph_content" id="page_table">
			<script type="text/html" id="resultpage_area">
			<%if(data.executeResult == 1){%>
				<% var _data = data.zphlb%>
				<%for(var i=0;i<_data.length;i++){%>
					<% var _item = _data[i]%>
			<div class="zph_c_item" zphid="<%=_item.zphid%>">
				<div class="item_top clearfix">
					<div class="top_left left">
						<span><%=_item.zphkssj%></span>
					</div>
					<div class="top_right right">
						<span>参会单位数量 <b><%=_item.cgdws%></b> 家</span>
					</div>
				</div>
				<div class="item_bottom clearfix">
					<div class="bottom_left left">
						<p class="i_b_name overshow" title="<%=_item.zphmc%>"><%=_item.zphmc%></p>
						<p class="i_b_dz">地址：<%=_item.zphdd%></p>
					</div>
					<div class="bottom_right right">
						<p class="i_b_name">主办单位</p>
						<p class="i_b_dz"><%=_item.zbjgmc%></p>
					</div>
				</div>
			</div>
			<%}%>
			<%}%>
		</script>
		</div>
		<!-- 公共尾部 -->
		<!-- <include src="./include/footer.html"></include> -->
	<script src="http://rsj.beijing.gov.cn/footer.js"></script>
	</div>
</body>
<script src="./common/vendor.js"></script>
<script src="./common/md5_32.js"></script>
<script src="./common/configuration.js"></script>
<script src="./common/common.js"></script>
<script src="./common/generaltools.js"></script>
<script src="./date/WdatePicker.js"></script>
<script>
	$(function () {

		var zpq_Arr = []; //招聘区县数组
		var dqrq = '';//系统时间
		// 获取基本信息
		getBase();

		codeTable('/jggsxslj','jycs_d_jggslxh', $('.list_jggs'), 'result'); //结果公示
		codeTable('/common/dmb','jycs_d_jgmllxh', $('.list_jgxx'), 'mechanism');//机构信息
		$('.zph_class').addClass('sub_active'); //给招聘会添加样式
		getQu();//获取招聘区


		// 跳转到招聘会详情
		$(document).on('click', '.zph_c_item', function () {
			window.open('./zphDetail.html?zphid=' + $(this).attr('zphid'));
		})
		// 查询
		$(document).on('click', '.J_search_submit', function () {
			var _kssj = $('#min').val();
			var _jssj = $('#max').val();
			var _ssmc = $('.search_input').val();
			var _zpq = zpq_Arr;
			getPage(_kssj, _jssj, _ssmc, _zpq);
		})
		// 选择城区
		$(document).on('click', '.z_zkq_list .zk_item', function () {
			var _class = $(this).hasClass('zk_active');
			if (!_class) {
				$(this).addClass('zk_active');
				$('.all_item').removeClass('zk_active');
				zpq_Arr.push($(this).attr('zpqid'))
				$('.J_search_submit').click();
			} else {
				$(this).removeClass('zk_active');
				zpq_Arr.splice(zpq_Arr.indexOf($(this).attr('zpqid')), 1);
				$('.J_search_submit').click();
			}
			if (zpq_Arr.length == 0) {
				$('.all_item').addClass('zk_active');
			}
		})
		// 全部区县
		$(document).on('click', '.z_zkq_list .all_item', function () {
			var _class = $(this).hasClass('zk_active');
			if (!_class) {
				$(this).addClass('zk_active');
				$('.zk_item').removeClass('zk_active');
				zpq_Arr = [];
				$('.J_search_submit').click();
			}
		})
		// 开始时间
		$(document).on('click', '#min', function () {
			WdatePicker({
				startDate: dqrq,
				dateFmt: 'yyyy-MM-dd',
				minDate: dqrq,
				maxDate: '#F{$dp.$D(\'max\')}',
				onpicked: time_fn,
				oncleared: clear_fn
			});
		})
		// 结束时间
		$(document).on('click', '#max', function () {
			WdatePicker({
				startDate: dqrq,
				dateFmt: 'yyyy-MM-dd',
				minDate: dqrq,
				onpicked: time_fn,
				oncleared: clear_fn
			});
		})
		function time_fn() {
			$('.J_search_submit').click();
		}
		function clear_fn() {
			$('.J_search_submit').click();
		}

		$(document).on('focus', '.search_input', function () {
			$(this).prev('.Showpass').hide();
		})
		$(document).on('blur', '.search_input', function () {
			if (!$(this).val()) {
				$(this).prev('.Showpass').show();
			}
		})
		// 获取区县
		function getQu() {
			$.fetch({
				url: '/zphxx/qxlbCx',
				type: 'get'
			}).done(function (res) {
				var _res = res.returnData;
				dqrq = _res.dqrq;
				// dqrq = '2018-01-01';
				if (+_res.executeResult == 1) {
					var _data = _res.qxlb;
					var _html = '<span class="all_item zk_active" zpqid="">全部</span>';
					$.each(_data, function (k, v) {
						_html += '<span class="zk_item" zpqid="' + v.xzqhdm + '">' + v.xzqhjc + '</span>'
					});
					$('.z_zkq_list').html(_html);
					getPage();
				} else {
					$.layerMsg(_res.message, '我知道了');
				}
			})
		}
		/**
		 * @desc 分页事件
		 * @param  kssj 开始时间
		 * @param  jssj 结束时间
		 * @param  ssmc 搜索关键字
		 * @param  zpq  查询区县集合
		 * */
		function getPage(kssj, jssj, ssmc, zpq) {
			var index = 0;
			var data = {
				kssj: kssj || '',
				jssj: jssj || '',
				ssmc: ssmc || '',
				zpq: zpq || [],
				pageSize: 20,
				pageNum: index
			}
			$('#page_table').pageTool({
				url: '/zphxx/zphlbCx',
				type: 'post',
				data: data,
				locator: 'returnData',
				errMes: '当前无相关招聘会信息！！',
				callback: function (result) {
					// Loading.off();
					var msg = result.returnData;
					if (msg.executeResult == '1') {
						$('.zph_num1').text(msg.sjxs['zphs']);
						$('.zph_num2').text(msg.sjxs['dws']);
						index++;
					} else {
						$('.zph_num1').text(msg.sjxs['zphs']);
						$('.zph_num2').text(msg.sjxs['dws']);
						$.layerMsg(msg.message, '我知道了', function () {
							return false;
						});
					}
				}
			});
		}
		// 获取代码表
		function codeTable(url,dmbm, ele, hre, dmid) {
			var _url = url;
			var _data = hre == 'result'? {} : {dmbm: dmbm};
			$.fetch({
				url:_url,
				type: 'get',
				data: _data
			}).done(function (result) {
				var data = result.returnData;
				if (+data.executeResult === 1) {
					// 数据数组
					var _data = data.data;
					var _html = '';
					var className = '';
					$.each(_data, function (k, v) {
						if (dmid && v.dmid == dmid) {
							className = 'sub_active';
						} else {
							className = '';
						}
						if (hre == 'mechanism' && v.dmid == '01') {
							_html += '<a  class="' + className + '" href="http://map.beijing.gov.cn/category?categoryId=rlzyggfwzx" target="_blank" dmid=' + v.dmid + ' title="' + v.dmmc + '">' + v.dmmc + '</a>'
						} else {
							_html += '<a  class="' + className + '" href="./' + hre + '.html?dmid=' + v.dmid + '" dmid=' + v.dmid + ' title="' + v.dmmc + '">' + v.dmmc + '</a>'
						}
					})
					ele.html(_html);
				} else {
					$.layerMsg(data.message, '我知道了');
				}
			});
		}
	});
</script>

</html>
